package com.ziroom.crm.mq.rabbit.spring.data;

import com.ziroom.crm.mq.core.data.Message;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * <p></p>
 * <p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 *
 * @author WeiShaoying
 * @version 1.0
 * @date Created in 2020年08月28日 17:04
 * @since 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class RabbitMessage extends Message implements Serializable {

    private static final long serialVersionUID = 3434861308406984270L;

    /**
     * 交换机名称,当为默认交换机时为空字符串, 发送时才有值
     */
    private String exchange;

    /**
     * 路由,发送时才有值
     */
    private String routingKey;

    /**
     * 队列名称, 消费才有值
     */
    private String queueName;

    /**
     * 消息配置,包括消息头等,是一个json String
     */
    private String messageProperties;

    @Builder
    public RabbitMessage(String messageBody, String id, String exchange, String routingKey, String messageProperties, String queueName) {
        super(id, messageBody);
        this.exchange = exchange;
        this.routingKey = routingKey;
        this.messageProperties = messageProperties;
        this.queueName = queueName;
    }
}
